var dict = new Object();

$(function(){	
    //Data structure to keep track of the SPARQL endpoint    
    if ($("input[id=addressMap]").val() !== "") {
        $.ajax({
            type: "GET",
            url: "predicates",
            data: {
                prefixes : $("input[id=addressMap]").val()
            },
            error: function(responseJSON){
                console.log(responseJSON);
            },
            success: function(responseJSON){
                $.each(responseJSON, function(key, value){
                    dict[key] = value;
                });

                var checkbox = "";
                for (var property in dict) {
                    checkbox += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <input type="checkbox" value='+ property + ' id=' + property + ' name=' + property + ' />' + property + ' <br/>';
                }
                $('#datasources').html(checkbox);
            }
        });
    }
});

$(document).ready(function() { 
    showProperties();
    $("#datasources").click(showProperties);
});